package com.xiaoshuidi.cloud.module.rooms.api.reserve;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.rooms.api.reserve.vo.PaymentSuccessfulDto;
import com.xiaoshuidi.cloud.module.rooms.api.reserve.vo.ReserveGetApiResp;
import com.xiaoshuidi.cloud.module.rooms.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;

/**
 * @Author Feng
 * @date 2023/5/30
 */
@FeignClient(name = ApiConstants.SERVERNAME)
@Tag(name = "RPC接口 - 预约相关接口")
public interface ReserveApi {
    String PREFIX = ApiConstants.PREFIX + "/reserve";

    @PostMapping(PREFIX + "/payment-successful")
    @Operation(summary = "预定支付成功")
    CommonResult<Boolean> paymentSuccessful(@Valid @RequestBody PaymentSuccessfulDto dto);

    @PostMapping(PREFIX + "/get-by-room-id")
    @Parameter(name = "roomHouseId", description = "房源id")
    @Operation(summary = "根据房间ID查询预定信息")
    CommonResult<ReserveGetApiResp> getByRoomId(@RequestParam("roomHouseId") Long roomHouseId);

    @PostMapping(PREFIX + "/sign-success")
    @Parameters({
            @Parameter(name = "roomHouseId", description = "房源id"),
            @Parameter(name = "memberId", description = "会员编号"),
    })
    @Operation(summary = "签约完成")
    CommonResult<Boolean> signSuccess(@RequestParam("roomHouseId") Long roomHouseId, @RequestParam("memberId") Long memberId);

    @PostMapping(PREFIX + "/sign-cancel")
    @Parameters({
            @Parameter(name = "roomHouseId", description = "房源id"),
            @Parameter(name = "memberId", description = "会员编号"),
    })
    @Operation(summary = "签约取消")
    CommonResult<Boolean> signCancel(@RequestParam("roomHouseId") Long roomHouseId, @RequestParam("memberId") Long memberId);
}
